<?php

/**
 * Testcase form base class.
 *
 * @package    form
 * @subpackage testcase
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseTestcaseForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'estimateexecution' => new sfWidgetFormInput(),
      'userid'            => new sfWidgetFormDoctrineSelect(array('model' => 'User', 'add_empty' => true)),
      'idcomponent'       => new sfWidgetFormDoctrineSelect(array('model' => 'Component', 'add_empty' => true)),
      'testsuitid'        => new sfWidgetFormDoctrineSelect(array('model' => 'Testsuite', 'add_empty' => true)),
      'title'             => new sfWidgetFormInput(),
      'steps'             => new sfWidgetFormTextarea(),
      'expectedresult'    => new sfWidgetFormTextarea(),
      'applicable'        => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorDoctrineChoice(array('model' => 'Testcase', 'column' => 'id', 'required' => false)),
      'estimateexecution' => new sfValidatorInteger(array('required' => false)),
      'userid'            => new sfValidatorDoctrineChoice(array('model' => 'User', 'required' => false)),
      'idcomponent'       => new sfValidatorDoctrineChoice(array('model' => 'Component', 'required' => false)),
      'testsuitid'        => new sfValidatorDoctrineChoice(array('model' => 'Testsuite', 'required' => false)),
      'title'             => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'steps'             => new sfValidatorString(array('max_length' => 2147483647, 'required' => false)),
      'expectedresult'    => new sfValidatorString(array('max_length' => 2147483647, 'required' => false)),
      'applicable'        => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('testcase[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Testcase';
  }

}